
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Important:
"       This requires that you install https://github.com/amix/vimrc !
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

" Built-in matchit
packadd! matchit

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Pathogen https://github.com/tpope/vim-pathogen
"
"   Pathogen is used to manage vim runtimepaths.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
runtime bundle/vim-pathogen/autoload/pathogen.vim
execute pathogen#infect()


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Ayu https://github.com/ayu-theme/ayu-vim
"   
"   Ayu is a great theme for vim.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Enable true colors support
try
    set termguicolors
    " Enable themes version (light|dark|mirage)
    let ayucolor="dark"
    colorscheme ayu
catch /E518/
    colorscheme pablo
endtry



"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Vim Tmux Navigator https://github.com/christoomey/vim-tmux-navigator
"   
"   Vim Tmux Navigator used integrate with tmux navigation.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Vimux https://github.com/benmills/vimux
"
"   Vimux is used to run command in vim, and integrated with
"   Tmux.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" F5 : Run current script
" noremap <leader>r :VimuxRunCommand(expand("%:p"))<cr>
noremap <leader>r :call ExecuteCurrentScript()<cr>

" Zoom the tmux runner page
map <Leader>bz :VimuxZoomRunner<CR>


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Helper functions
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

function! ExecuteCurrentScript()
    let l:current = expand("%:p")
    if executable(l:current) == 0
        VimuxRunCommand("chmod +x " . l:current)
    endif
    VimuxRunCommand(l:current)
endfunction
